using Microsoft.EntityFrameworkCore;

namespace MovieDBReverseEngineering
{
    /// <summary>
    /// 电影数据库上下文类
    /// 用于实体框架与数据库之间的交互
    /// </summary>
    public partial class MovieDBContext : DbContext
    {
        public virtual DbSet<Artist> Artists { get; set; }
        public virtual DbSet<Movie> Movies { get; set; }
        public virtual DbSet<Participation> Participations { get; set; }

        public MovieDBContext() { }

        public MovieDBContext(DbContextOptions<MovieDBContext> options) 
            : base(options) { }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                // 这里可以设置默认的连接字符串
                // 实际使用时应该从配置文件或环境变量中读取
                // optionsBuilder.UseSqlServer("Server=(localdb)\mssqllocaldb;Database=MovieDB;Trusted_Connection=True;");
                // 或MySQL连接
                // optionsBuilder.UseMySQL("server=localhost;port=3306;database=MovieDB;user=root;password=your_password;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            // 实体配置将由反向工程自动生成
            // 这里可以添加额外的配置
        }
    }
}